package org.maxkey.portal.core.cam;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 系统常量定义
 *
 */
@ToString
@Getter
@Setter
public class AuthResult {

	/**
	 * 状态码
	 */
	//@ApiModelProperty(value="状态码")
	private int code;
	/**
	 * 响应内容
	 */
	//@ApiModelProperty(value="响应消息")
	private String msg;

	/**
	 * 凭证的有效时间（秒）
	 */
	//@ApiModelProperty(value="存活时间")
	private Long expires_in;

	/**
	 * 令牌
	 */
	//@ApiModelProperty(value="令牌")
	private String access_token;

	public AuthResult() {
		super();
	}

	public AuthResult(int code) {
		super();
		this.code = code;
		if(this.code == Constants.SUCCESS){
			this.msg="OK";
		}else{
			this.msg="凭证验证失败";
		}
	}

	public AuthResult(int code, String msg) {
		super();
		this.code = code;
		this.msg = msg;
		if(this.code==Constants.SUCCESS){
			this.msg="OK";
		}else{
			this.msg="凭证验证失败";
		}
	}

	public AuthResult(int code, String msg,Long expires_in,String access_token) {
		super();
		this.code = code;
		this.msg = msg;
		this.expires_in = expires_in;
		this.access_token = access_token;
	}

	public AuthResult(int code,Long expires_in,String access_token) {
		super();
		this.code = code;
		if(this.code==Constants.SUCCESS){
			this.msg="OK";
		}else{
			this.msg="凭证验证失败";
		}
		this.expires_in = expires_in;
		this.access_token = access_token;
	}
}
